package MyOop03;

import java.util.Scanner;

public class CarTest {
    public static void main(String[] args) {
        Car[] arr = new Car[3];

        Scanner scanner = new Scanner(System.in);
        for (int i = 0; i < arr.length; i++) {
            Car a = new Car();
            System.out.println("请输入汽车的品牌：");
            String brand = scanner.next();
            a.setBrand(brand);
            System.out.println("请输入汽车的价格：");
            int price = scanner.nextInt();
            a.setPrice(price);
            System.out.println("请输入汽车的颜色：");
            String color = scanner.next();
            a.setColor(color);
            arr[i] = a;
        }
        for (int i = 0; i < arr.length; i++) {
            Car car = arr[i];
            System.out.println(car.getBrand()+","+car.getPrice()+","+car.getColor());
        }
    }
}
